#define DEBUG
using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Web;

namespace DAC.HttpWeb
{
	public class HttpWeb
	{
		public CookieContainer cookieJar;

		public bool IsUTF8;

		public HtmlDocument Document;

		private string _headerFromServer;

		private string _responseFromServer;

		private string TAG = "HttpWeb";

		private Uri _responseUri;

		public int Timeout
		{
			get;
			set;
		}

		public string HeaderFromServer
		{
			get
			{
				return this._headerFromServer;
			}
		}

		public string ResponseFromServer
		{
			get
			{
				return this._responseFromServer;
			}
		}

		public Uri ResponseUri
		{
			get
			{
				return this._responseUri;
			}
		}

		public bool IsError
		{
			get;
			set;
		}

		public string LastError
		{
			get;
			set;
		}

		public HttpWeb()
		{
			this.IsUTF8 = false;
			this.cookieJar = new CookieContainer();
			this.Document = new HtmlDocument();
			this.Timeout = 30;
		}

		public string Navigate(string url, string headers, string postData, bool allowAutoRedirect)
		{
			string text = default(string);
			string text2 = default(string);
			string result = this.Navigate(url, headers, postData, allowAutoRedirect, out text, out text2);
			if (string.IsNullOrEmpty(text) && string.IsNullOrEmpty(text2))
			{
				return result;
			}
			return text + "\r\n" + text2;
		}

		public string Navigate(string url, string headers, string postData, out string headerFromServer, out string responseFromServer)
		{
			return this.Navigate(url, headers, postData, true, out headerFromServer, out responseFromServer);
		}

		public string Navigate(string url, string headers, string postData, bool allowAutoRedirect, out string headerFromServer, out string responseFromServer)
		{
			headerFromServer = "";
			responseFromServer = "";
			this.IsError = false;
			this.LastError = "";
			try
			{
				ServicePointManager.DefaultConnectionLimit = 100;
				ServicePointManager.UseNagleAlgorithm = false;
				HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
				httpWebRequest.Proxy = null;
				httpWebRequest.Timeout = this.Timeout * 1000;
				httpWebRequest.ReadWriteTimeout = this.Timeout * 1000;
				httpWebRequest.CookieContainer = this.cookieJar;
				httpWebRequest.Method = "POST";
				httpWebRequest.AllowAutoRedirect = allowAutoRedirect;
				httpWebRequest.ProtocolVersion = HttpVersion.Version11;
				httpWebRequest.ServicePoint.Expect100Continue = false;
				httpWebRequest.ServicePoint.ConnectionLimit = 100;
				ServicePoint servicePoint = httpWebRequest.ServicePoint;
				PropertyInfo property = servicePoint.GetType().GetProperty("HttpBehaviour", BindingFlags.Instance | BindingFlags.NonPublic);
				property.SetValue(servicePoint, (byte)0, null);
				if (string.IsNullOrEmpty(postData))
				{
					httpWebRequest.Method = "GET";
				}
				string[] array = headers.Split('\n');
				string[] array2 = array;
				foreach (string text in array2)
				{
					string text2 = text.Trim();
					if (!string.IsNullOrEmpty(text2))
					{
						string a = default(string);
						string text3 = default(string);
						HttpWeb.ParseHeader(text2, out a, out text3);
						if ((!(httpWebRequest.Method == "GET") || !(a == "Content-Type")) && !(a == "Accept-Encoding"))
						{
							if (a == "Accept")
							{
								httpWebRequest.Accept = text3;
							}
							else if (a == "Connection")
							{
								if (text3.ToLower() == "close")
								{
									httpWebRequest.KeepAlive = false;
								}
								else
								{
									httpWebRequest.KeepAlive = true;
								}
							}
							else if (a == "Content-Type")
							{
								httpWebRequest.ContentType = text3;
							}
							else if (a == "Expect")
							{
								httpWebRequest.Expect = text3;
							}
							else if (a == "Date")
							{
								httpWebRequest.Date = DateTime.Parse(text3);
							}
							else if (a == "If-Modified-Since")
							{
								httpWebRequest.IfModifiedSince = DateTime.Parse(text3);
							}
							else if (!(a == "Range"))
							{
								if (a == "Referer")
								{
									httpWebRequest.Referer = text3;
								}
								else if (a == "Transfer-Encoding")
								{
									httpWebRequest.TransferEncoding = text3;
								}
								else if (a == "User-Agent")
								{
									httpWebRequest.UserAgent = text3;
								}
								else
								{
									httpWebRequest.Headers.Add(text2);
								}
							}
						}
					}
				}
				Stream requestStream;
				if (httpWebRequest.Method == "POST")
				{
					byte[] array3 = (!this.IsUTF8) ? Encoding.Default.GetBytes(postData) : Encoding.UTF8.GetBytes(postData);
					httpWebRequest.ContentLength = array3.Length;
					requestStream = httpWebRequest.GetRequestStream();
					requestStream.Write(array3, 0, array3.Length);
					requestStream.Close();
				}
				WebResponse response = httpWebRequest.GetResponse();
				string statusDescription = ((HttpWebResponse)response).StatusDescription;
				headerFromServer = string.Format("{0}", response.Headers);
				this._responseUri = response.ResponseUri;
				Debug.WriteLine(this.TAG + "URL:" + response.ResponseUri.AbsoluteUri);
				if (headerFromServer.ToUpper().Contains("UTF-8"))
				{
					this.IsUTF8 = true;
				}
				else
				{
					this.IsUTF8 = false;
				}
				requestStream = response.GetResponseStream();
				StreamReader streamReader = (!this.IsUTF8) ? new StreamReader(requestStream, Encoding.Default, true) : new StreamReader(requestStream, Encoding.UTF8, true);
				responseFromServer = streamReader.ReadToEnd();
				streamReader.Close();
				requestStream.Close();
				response.Close();
			}
			catch (Exception ex)
			{
				this.IsError = true;
				this.LastError = ex.Message;
				return "오류!" + ex.Message;
			}
			this.Document.LoadHtml(responseFromServer);
			this._headerFromServer = headerFromServer;
			this._responseFromServer = responseFromServer;
			return headerFromServer + "\r\n" + responseFromServer;
		}

		public Dictionary<string, string> GetDefaultHeader()
		{
			return this.GetDefaultHeader(true);
		}

		public Dictionary<string, string> GetDefaultHeader(bool isPost)
		{
			return this.GetDefaultHeader(isPost, null);
		}

		public Dictionary<string, string> GetDefaultHeader(bool isPost, string multipartBoundary)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			dictionary.Add("Accept", "text/html, application/xhtml+xml, */*");
			dictionary.Add("Accept-Language", "ko-KR");
			dictionary.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36");
			if (isPost)
			{
				if (string.IsNullOrEmpty(multipartBoundary))
				{
					dictionary.Add("Content-Type", "application/x-www-form-urlencoded");
				}
				else
				{
					dictionary.Add("Content-Type", "multipart/form-data; boundary=" + multipartBoundary);
				}
			}
			dictionary.Add("Accept-Encoding", "gzip, deflate");
			return dictionary;
		}

		public Dictionary<string, string> GetDefaultHeader(bool isPost, string multipartBoundary, int userAgent)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			dictionary.Add("Accept-Language", "ko-KR");
			dictionary.Add("Accept", "text/html, application/xhtml+xml, */*");
			string value = "";
			switch (userAgent)
			{
			case 1:
				value = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.3; WOW64; Trident/7.0)";
				break;
			case 2:
				value = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36";
				break;
			}
			dictionary.Add("User-Agent", value);
			if (isPost)
			{
				if (string.IsNullOrEmpty(multipartBoundary))
				{
					dictionary.Add("Content-Type", "application/x-www-form-urlencoded");
				}
				else
				{
					dictionary.Add("Content-Type", "multipart/form-data; boundary=" + multipartBoundary);
				}
			}
			dictionary.Add("Accept-Encoding", "gzip, deflate");
			return dictionary;
		}

		public void Navigate(string url)
		{
			string text = default(string);
			string text2 = default(string);
			this.Navigate(url, this.GetDefaultHeader(false), (Dictionary<string, string>)null, true, out text, out text2);
		}

		public bool Navigate(string url, Dictionary<string, string> headers, Dictionary<string, string> posts)
		{
			string text = default(string);
			string text2 = default(string);
			this.Navigate(url, headers, posts, true, out text, out text2);
			return !this.IsParseError();
		}

		public bool Navigate(string url, Dictionary<string, string> headers, Dictionary<string, string> posts, bool allowAutoRedirect)
		{
			string text = default(string);
			string text2 = default(string);
			this.Navigate(url, headers, posts, allowAutoRedirect, out text, out text2);
			return !this.IsParseError();
		}

		public string Navigate(string url, Dictionary<string, string> headers, Dictionary<string, string> posts, out string headerFromServer, out string responseFromServer)
		{
			StringBuilder stringBuilder = new StringBuilder();
			StringBuilder stringBuilder2 = new StringBuilder();
			Dictionary<string, string>.Enumerator enumerator;
			KeyValuePair<string, string> current;
			if (headers != null)
			{
				enumerator = headers.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						current = enumerator.Current;
						stringBuilder.Append(current.Key);
						stringBuilder.Append(": ");
						stringBuilder.Append(current.Value.Trim());
						stringBuilder.Append("\r\n");
					}
				}
				finally
				{
					((IDisposable)enumerator).Dispose();
				}
			}
			if (posts != null)
			{
				enumerator = posts.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						current = enumerator.Current;
						stringBuilder2.Append(current.Key);
						stringBuilder2.Append("=");
						if (this.IsUTF8)
						{
							stringBuilder2.Append(HttpUtility.UrlEncode(current.Value, Encoding.UTF8));
						}
						else
						{
							stringBuilder2.Append(HttpUtility.UrlEncode(current.Value, Encoding.Default));
						}
						stringBuilder2.Append("&");
					}
				}
				finally
				{
					((IDisposable)enumerator).Dispose();
				}
				stringBuilder2.Remove(stringBuilder2.Length - 1, 1);
			}
			return this.Navigate(url, stringBuilder.ToString(), stringBuilder2.ToString(), true, out headerFromServer, out responseFromServer);
		}

		public string Navigate(string url, Dictionary<string, string> headers, List<KeyValuePair<string, string>> posts, out string headerFromServer, out string responseFromServer, bool isEnc)
		{
			StringBuilder stringBuilder = new StringBuilder();
			StringBuilder stringBuilder2 = new StringBuilder();
			KeyValuePair<string, string> current;
			if (headers != null)
			{
				foreach (KeyValuePair<string, string> header in headers)
				{
					current = header;
					stringBuilder.Append(current.Key);
					stringBuilder.Append(": ");
					stringBuilder.Append(current.Value.Trim());
					stringBuilder.Append("\r\n");
				}
			}
			if (posts != null)
			{
				foreach (KeyValuePair<string, string> post in posts)
				{
					current = post;
					stringBuilder2.Append(current.Key);
					stringBuilder2.Append("=");
					if (isEnc)
					{
						if (this.IsUTF8)
						{
							stringBuilder2.Append(HttpUtility.UrlEncode(current.Value, Encoding.UTF8));
						}
						else
						{
							stringBuilder2.Append(HttpUtility.UrlEncode(current.Value, Encoding.Default));
						}
					}
					else if (this.IsUTF8)
					{
						stringBuilder2.Append(current.Value);
					}
					else
					{
						stringBuilder2.Append(current.Value);
					}
					stringBuilder2.Append("&");
				}
				stringBuilder2.Remove(stringBuilder2.Length - 1, 1);
			}
			return this.Navigate(url, stringBuilder.ToString(), stringBuilder2.ToString(), true, out headerFromServer, out responseFromServer);
		}

		public string Navigate(string url, Dictionary<string, string> headers, Dictionary<string, string> posts, bool allowAutoRedirect, out string headerFromServer, out string responseFromServer)
		{
			StringBuilder stringBuilder = new StringBuilder();
			StringBuilder stringBuilder2 = new StringBuilder();
			Dictionary<string, string>.Enumerator enumerator;
			KeyValuePair<string, string> current;
			if (headers != null)
			{
				enumerator = headers.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						current = enumerator.Current;
						stringBuilder.Append(current.Key);
						stringBuilder.Append(": ");
						stringBuilder.Append(current.Value.Trim());
						stringBuilder.Append("\r\n");
					}
				}
				finally
				{
					((IDisposable)enumerator).Dispose();
				}
			}
			if (posts != null)
			{
				enumerator = posts.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						current = enumerator.Current;
						stringBuilder2.Append(current.Key);
						stringBuilder2.Append("=");
						stringBuilder2.Append(HttpUtility.UrlEncode(current.Value, Encoding.Default));
						stringBuilder2.Append("&");
					}
				}
				finally
				{
					((IDisposable)enumerator).Dispose();
				}
				stringBuilder2.Remove(stringBuilder2.Length - 1, 1);
			}
			return this.Navigate(url, stringBuilder.ToString(), stringBuilder2.ToString(), allowAutoRedirect, out headerFromServer, out responseFromServer);
		}

		public static bool ParseHeader(string s, out string name, out string value)
		{
			int num = s.IndexOf(":");
			if (num > 0)
			{
				name = s.Substring(0, num).Trim();
				value = s.Substring(num + 1).Trim();
				return true;
			}
			name = "";
			value = "";
			return false;
		}

		public static string UpperCaseUrlEncode(string s)
		{
			char[] array = HttpUtility.UrlEncode(s).ToCharArray();
			for (int i = 0; i < array.Length - 2; i++)
			{
				if (array[i] == '%')
				{
					array[i + 1] = char.ToUpper(array[i + 1]);
					array[i + 2] = char.ToUpper(array[i + 2]);
				}
			}
			return new string(array);
		}

		private void SaveResponse(string response, string path, Encoding enc)
		{
			using (StreamWriter streamWriter = new StreamWriter(path, false, enc))
			{
				streamWriter.Write(response);
			}
		}

		public bool ParseValue(string response, string id, out string value)
		{
			HtmlDocument htmlDocument = new HtmlDocument();
			htmlDocument.LoadHtml(response);
			if (htmlDocument.ParseErrors != null && htmlDocument.ParseErrors.Count() > 0)
			{
				value = "";
				return false;
			}
			HtmlNode htmlNode = htmlDocument.DocumentNode.SelectSingleNode("//*[@id='" + id + "']");
			if (htmlNode != null)
			{
				value = htmlNode.Attributes["value"].Value;
			}
			else
			{
				value = "";
			}
			return true;
		}

		public bool ParseValue(string id, out string value)
		{
			if (this.IsParseError())
			{
				value = "";
				return false;
			}
			HtmlNode htmlNode = this.Document.DocumentNode.SelectSingleNode("//*[@id='" + id + "']");
			if (htmlNode != null)
			{
				value = htmlNode.Attributes["value"].Value;
			}
			else
			{
				value = "";
			}
			return true;
		}

		public bool IsParseError()
		{
			return this.IsError || this.Document == null || this.Document.DocumentNode == null || this.ResponseFromServer == null;
		}

		private string GetHeader(string p, string item)
		{
			string[] array = p.Split('\n');
			string[] array2 = array;
			foreach (string text in array2)
			{
				text.Trim();
				string a = default(string);
				string result = default(string);
				if (HttpWeb.ParseHeader(text, out a, out result) && a == item)
				{
					return result;
				}
			}
			return "";
		}

		public HtmlNode GetNodeById(string id)
		{
			if (this.IsParseError())
			{
				return null;
			}
			return this.GetNodeById(this.Document.DocumentNode, id);
		}

		public HtmlNode GetNodeById(HtmlNode parentNode, string id)
		{
			if (this.IsParseError())
			{
				return null;
			}
			return parentNode.SelectSingleNode(".//*[@id='" + id + "']");
		}

		public HtmlNodeCollection GetNodesByTagName(string tagName)
		{
			if (this.IsParseError())
			{
				return null;
			}
			return this.GetNodesByTagName(this.Document.DocumentNode, tagName);
		}

		public HtmlNodeCollection GetNodesByTagName(HtmlNode parentNode, string tagName)
		{
			if (parentNode == null)
			{
				return null;
			}
			return parentNode.SelectNodes(".//" + tagName);
		}

		public string[] getOuterHtmlByTagName(string tagName)
		{
			return this.getOuterHtmlByTagName(this.ResponseFromServer, tagName);
		}

		public string[] getOuterHtmlByTagName(string htmlSource, string tagName)
		{
			List<string> list = new List<string>();
			int num = 0;
			int num2 = 0;
			string value = "<" + tagName;
			string text = "</" + tagName + ">";
			string text2 = ">";
			while (true)
			{
				bool flag = true;
				num = htmlSource.IndexOf(value, num2, StringComparison.CurrentCultureIgnoreCase);
				if (num != -1)
				{
					num2 = htmlSource.IndexOf(text, num, StringComparison.CurrentCultureIgnoreCase);
					if (num2 == -1)
					{
						text = text2;
						num2 = htmlSource.IndexOf(text2, num, StringComparison.CurrentCultureIgnoreCase);
						if (num2 == -1)
						{
							break;
						}
					}
					list.Add(htmlSource.Substring(num, num2 + text.Length - num));
					continue;
				}
				break;
			}
			return list.ToArray();
		}

		public string getValue(string htmlSource)
		{
			int num = 0;
			int startIndex = 0;
			string text = "value=";
			num = htmlSource.IndexOf(text, startIndex, StringComparison.CurrentCultureIgnoreCase);
			if (num == -1)
			{
				return null;
			}
			num += text.Length;
			startIndex = htmlSource.IndexOf(" ", num, StringComparison.CurrentCultureIgnoreCase);
			if (startIndex == -1)
			{
				startIndex = htmlSource.IndexOf(">", num, StringComparison.CurrentCultureIgnoreCase);
				if (startIndex == -1)
				{
					return null;
				}
			}
			return htmlSource.Substring(num, startIndex - num).Replace("'", "").Replace("\"", "")
				.Replace("\\", "")
				.Trim();
		}

		public bool Navigate(string url, Dictionary<string, string> headers, Dictionary<string, string> posts, string boundary, List<Attachment> attaches)
		{
			string text = "";
			string text2 = "";
			this.IsError = false;
			this.LastError = "";
			try
			{
				HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
				httpWebRequest.Timeout = this.Timeout * 1000;
				httpWebRequest.CookieContainer = this.cookieJar;
				httpWebRequest.Method = "POST";
				if (posts == null || posts.Count == 0)
				{
					httpWebRequest.Method = "GET";
				}
				httpWebRequest.ProtocolVersion = HttpVersion.Version11;
				httpWebRequest.ServicePoint.Expect100Continue = false;
				Dictionary<string, string>.KeyCollection.Enumerator enumerator = headers.Keys.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						string current = enumerator.Current;
						string text3 = headers[current];
						if ((!(httpWebRequest.Method == "GET") || !(current == "Content-Type")) && !(current == "Accept-Encoding"))
						{
							if (current == "Accept")
							{
								httpWebRequest.Accept = text3;
							}
							else if (current == "Connection")
							{
								if (text3.ToLower() == "close")
								{
									httpWebRequest.KeepAlive = false;
								}
								else
								{
									httpWebRequest.KeepAlive = true;
								}
							}
							else if (current == "Content-Type")
							{
								httpWebRequest.ContentType = text3;
							}
							else if (current == "Expect")
							{
								httpWebRequest.Expect = text3;
							}
							else if (current == "Date")
							{
								httpWebRequest.Date = DateTime.Parse(text3);
							}
							else if (current == "If-Modified-Since")
							{
								httpWebRequest.IfModifiedSince = DateTime.Parse(text3);
							}
							else if (!(current == "Range"))
							{
								if (current == "Referer")
								{
									httpWebRequest.Referer = text3;
								}
								else if (current == "Transfer-Encoding")
								{
									httpWebRequest.TransferEncoding = text3;
								}
								else if (current == "User-Agent")
								{
									httpWebRequest.UserAgent = text3;
								}
								else
								{
									httpWebRequest.Headers.Add(current + ": " + text3);
								}
							}
						}
					}
				}
				finally
				{
					((IDisposable)enumerator).Dispose();
				}
				if (httpWebRequest.Method == "POST")
				{
					MemoryStream memoryStream = new MemoryStream();
					enumerator = posts.Keys.GetEnumerator();
					try
					{
						while (enumerator.MoveNext())
						{
							string current2 = enumerator.Current;
							string text3 = posts[current2];
							string str = "";
							str = str + "--" + boundary + "\r\n";
							str = str + "Content-Disposition: form-data; name=\"" + current2 + "\"\r\n\r\n";
							str = str + text3 + "\r\n";
							byte[] bytes = this.GetBytes(str);
							memoryStream.Write(bytes, 0, bytes.Length);
						}
					}
					finally
					{
						((IDisposable)enumerator).Dispose();
					}
					foreach (Attachment attach in attaches)
					{
						string str = string.Format("--{0}\r\nContent-Disposition: form-data; name=\"{1}\"; filename=\"{2}\"\r\nContent-Type: {3}\r\n\r\n", boundary, attach.Name, attach.FileName, attach.MediaType);
						byte[] bytes = this.GetBytes(str);
						memoryStream.Write(bytes, 0, bytes.Length);
						if (attach.Data != null)
						{
							memoryStream.Write(attach.Data, 0, attach.Data.Length);
						}
						bytes = this.GetBytes("\r\n");
						memoryStream.Write(bytes, 0, bytes.Length);
					}
					if (memoryStream.Length > 0)
					{
						string str = string.Format("--{0}--\r\n", boundary);
						byte[] bytes = this.GetBytes(str);
						memoryStream.Write(bytes, 0, bytes.Length);
					}
					byte[] array = memoryStream.ToArray();
					memoryStream.Close();
					httpWebRequest.ContentLength = array.Length;
					using (Stream stream = httpWebRequest.GetRequestStream())
					{
						stream.Write(array, 0, array.Length);
					}
				}
				WebResponse response = httpWebRequest.GetResponse();
				string statusDescription = ((HttpWebResponse)response).StatusDescription;
				text = string.Format("{0}", response.Headers);
				this._responseUri = response.ResponseUri;
				Debug.WriteLine(this.TAG + "URL:" + response.ResponseUri.AbsoluteUri);
				if (text.ToUpper().Contains("UTF-8"))
				{
					this.IsUTF8 = true;
				}
				else
				{
					this.IsUTF8 = false;
				}
				using (Stream stream = response.GetResponseStream())
				{
					StreamReader streamReader = (!this.IsUTF8) ? new StreamReader(stream, Encoding.Default, true) : new StreamReader(stream, Encoding.UTF8, true);
					text2 = streamReader.ReadToEnd();
					streamReader.Close();
				}
				response.Close();
			}
			catch (Exception ex)
			{
				this.IsError = true;
				this.LastError = ex.Message;
				return false;
			}
			this.Document.LoadHtml(text2);
			this._headerFromServer = text;
			this._responseFromServer = text2;
			return !this.IsParseError();
		}

		private byte[] GetBytes(string data)
		{
			if (this.IsUTF8)
			{
				return Encoding.UTF8.GetBytes(data);
			}
			return Encoding.Default.GetBytes(data);
		}

		public Dictionary<string, string> GetFormAttributes(string formID)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			string[] outerHtmlByTagName = this.getOuterHtmlByTagName("form");
			string[] array = outerHtmlByTagName;
			foreach (string text in array)
			{
				if (text.Contains("id=\"" + formID + "\""))
				{
					string[] outerHtmlByTagName2 = this.getOuterHtmlByTagName(text, "input");
					foreach (string text2 in outerHtmlByTagName2)
					{
						HtmlDocument htmlDocument = new HtmlDocument();
						htmlDocument.LoadHtml(text2);
						if (htmlDocument.ParseErrors != null && htmlDocument.ParseErrors.Count() > 0)
						{
							Debug.WriteLine(this.TAG + " input 파싱 에러 " + text2);
						}
						else
						{
							try
							{
								HtmlNode htmlNode = htmlDocument.DocumentNode.SelectSingleNode(".//input[@type='hidden']");
								if (htmlNode != null)
								{
									dictionary.Add(htmlNode.Attributes["name"].Value, htmlNode.Attributes["value"].Value);
								}
							}
							catch
							{
							}
						}
					}
					break;
				}
			}
			return dictionary;
		}
	}
}
